package com.gyh.system.common.utils;

import java.util.HashMap;
import java.util.Map;

import org.springframework.http.HttpStatus;

/**
* @author 作者 gyh:
* @version 创建时间：2018年1月13日 上午1:58:49
* 
*/
public class Rt extends HashMap<String, Object>{
	private static final long serialVersionUID = 1L;
	
	public Rt() {
		put("code", 0);
	}
	
	public static Rt error() {
		return error(500, "未知异常，请联系管理员");
	}
	
	public static Rt error(String msg) {
		return error(500, msg);
	}
	
	public static Rt error(int code, String msg) {
		Rt rt = new Rt();
		rt.put("code", code);
		rt.put("msg", msg);
		return rt;
	}
	
	public static Rt error(String url, String msg) {
		Rt rt = new Rt();
		rt.put("url", url);
		rt.put("msg", msg);
		return rt;
	}
	
	public static Rt Url(String url) {
		Rt rt = new Rt();
		rt.put("url", url);
		return rt;
	}

	public static Rt ok(String msg) {
		Rt rt = new Rt();
		rt.put("msg", msg);
		return rt;
	}
	
	public static Rt ok(Map<String, Object> map) {
		Rt rt = new Rt();
		rt.putAll(map);
		return rt;
	}
	
	public static Rt ok() {
		return new Rt();
	}

	public Rt put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}
